﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace SyncDBServer
{
    class ServiceSettings
    {
        public const int CONCURRENT_COUNT = 10;
        private static ServiceSettings settings = null;

        public static ServiceSettings GetInstance()
        {
            if (settings == null)
                settings = new ServiceSettings();
            return settings;
        }

        private ServiceSettings()
        {
            ConnectionString = ConfigurationManager.AppSettings["cs"];
            ListenPoint = ConfigurationManager.AppSettings["listen"];
            MaxConnectionNum = Int32.Parse(ConfigurationManager.AppSettings["net.max_connection_num"]);
            MaxAcceptNum = Int32.Parse(ConfigurationManager.AppSettings["net.max_accept_num"]);
            WaitAcceptNum = Int32.Parse(ConfigurationManager.AppSettings["net.wait_accept_num"]);
            BufferSize = Int32.Parse(ConfigurationManager.AppSettings["net.buffer_size"]);
            LogFile = ConfigurationManager.AppSettings["log.file"];
            LogQueue = ConfigurationManager.AppSettings["log.queue"];
        }

        public string ConnectionString { get; set; }

        public string ListenPoint { get; set; }

        public int BufferSize { get; set; }

        public int MaxConnectionNum { get; set; }

        public int MaxAcceptNum { get; set; }

        public int WaitAcceptNum { get; set; }

        public string LogFile { get; set; }

        public string LogQueue { get; set; }
    }
}
